/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package fir.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import fir.FirPackage;
import fir.Funcionalidade;
import fir.util.EditPartAdapter;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Funcionalidade</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fir.impl.FuncionalidadeImpl#getLabel <em>Label</em>}</li>
 *   <li>{@link fir.impl.FuncionalidadeImpl#getDescricao <em>Descricao</em>}</li>
 *   <li>{@link fir.impl.FuncionalidadeImpl#isSoftware <em>Software</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class FuncionalidadeImpl extends EObjectImpl implements Funcionalidade {
	/**
	 * The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLabel()
	 * @generated
	 * @ordered
	 */
	protected static final String LABEL_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getLabel() <em>Label</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLabel()
	 * @generated
	 * @ordered
	 */
	protected String label = LABEL_EDEFAULT;

	/**
	 * The default value of the '{@link #getDescricao() <em>Descricao</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescricao()
	 * @generated
	 * @ordered
	 */
	protected static final String DESCRICAO_EDEFAULT = "";

	/**
	 * The cached value of the '{@link #getDescricao() <em>Descricao</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescricao()
	 * @generated
	 * @ordered
	 */
	protected String descricao = DESCRICAO_EDEFAULT;

	/**
	 * The default value of the '{@link #isSoftware() <em>Software</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isSoftware()
	 * @generated not
	 * @ordered
	 */
	protected static final boolean SOFTWARE_EDEFAULT = true;

	/**
	 * The cached value of the '{@link #isSoftware() <em>Software</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isSoftware()
	 * @generated
	 * @ordered
	 */
	protected boolean software = SOFTWARE_EDEFAULT;
	
	/**
	 * @generated not
	 */
	private EditPartAdapter editPartAdapter;

	/**
	 * The cached value of the '{@link #isCheck() <em>Check</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isCheck()
	 * @generated not
	 * @ordered
	 */
	protected boolean check = false;
	
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected FuncionalidadeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return FirPackage.Literals.FUNCIONALIDADE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getLabel() {
		return label;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLabel(String newLabel) {
		String oldLabel = label;
		label = newLabel;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, FirPackage.FUNCIONALIDADE__LABEL, oldLabel, label));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDescricao() {
		return descricao;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDescricao(String newDescricao) {
		String oldDescricao = descricao;
		descricao = newDescricao;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, FirPackage.FUNCIONALIDADE__DESCRICAO, oldDescricao, descricao));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSoftware() {
		return software;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated not
	 */
	public void setSoftware(boolean newSoftware) {
		boolean oldSoftware = software;
		software = newSoftware;
		if(newSoftware){
			editPartAdapter.setBackgroundColor(69, 139, 0);
		}else{
			editPartAdapter.setBackgroundColor(139, 136, 120);
			
		}
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, FirPackage.FUNCIONALIDADE__SOFTWARE, oldSoftware, software));
	}

	/**
	 * @generated not
	 */
	public boolean isCheck() {
		return check;
	}

	/**
	 * @generated not
	 */
	public void setCheck(boolean check) {
		this.check = check;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case FirPackage.FUNCIONALIDADE__LABEL:
				return getLabel();
			case FirPackage.FUNCIONALIDADE__DESCRICAO:
				return getDescricao();
			case FirPackage.FUNCIONALIDADE__SOFTWARE:
				return isSoftware() ? Boolean.TRUE : Boolean.FALSE;
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case FirPackage.FUNCIONALIDADE__LABEL:
				setLabel((String)newValue);
				return;
			case FirPackage.FUNCIONALIDADE__DESCRICAO:
				setDescricao((String)newValue);
				return;
			case FirPackage.FUNCIONALIDADE__SOFTWARE:
				setSoftware(((Boolean)newValue).booleanValue());
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case FirPackage.FUNCIONALIDADE__LABEL:
				setLabel(LABEL_EDEFAULT);
				return;
			case FirPackage.FUNCIONALIDADE__DESCRICAO:
				setDescricao(DESCRICAO_EDEFAULT);
				return;
			case FirPackage.FUNCIONALIDADE__SOFTWARE:
				setSoftware(SOFTWARE_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case FirPackage.FUNCIONALIDADE__LABEL:
				return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
			case FirPackage.FUNCIONALIDADE__DESCRICAO:
				return DESCRICAO_EDEFAULT == null ? descricao != null : !DESCRICAO_EDEFAULT.equals(descricao);
			case FirPackage.FUNCIONALIDADE__SOFTWARE:
				return software != SOFTWARE_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (label: ");
		result.append(label);
		result.append(", descricao: ");
		result.append(descricao);
		result.append(", software: ");
		result.append(software);
		result.append(')');
		return result.toString();
	}

	/**
	 * @generated not
	 */
	public EditPartAdapter getEditPartAdapter() {
		return editPartAdapter;
	}

	/**
	 * @generated not
	 */
	public void setEditPartAdapter(EditPartAdapter editPartAdapter) {
		this.editPartAdapter = editPartAdapter;
	}

} //FuncionalidadeImpl
